The React Workshop by Brandon Richey Ryan Yu Endre Vegh Theofanis Despoudis Anton Punith and Florian Sloot

The React Workshop by Brandon Richey Ryan Yu Endre Vegh Theofanis Despoudis Anton Punith and Florian Sloot

Author:Brandon Richey, Ryan Yu, Endre Vegh, Theofanis Despoudis, Anton Punith, and Florian Sloot
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2020-08-21T00:00:00+00:00


Exercise 10.04: Protected Routes

In this exercise, we are going to look at the usage of protected routes.

Create a new App:npx create-react-app protected-routes

Go to the src/App.js file and delete logo.svg, App.css, and clear out the contents of App.js.

Import the App.css file we used in Chapter 8, Introduction to Formik.

Import the required modules:yarn add react-router-dom formik

Import the necessary modules:import React from 'react';

import { Formik, Form, Field } from 'formik';

import { Prompt, Link, Switch, Route, BrowserRouter as Router, Redirect } from 'react-router-dom';

import './App.css';



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.